import { APILX } from '@/api/requestLx'

export let outopenItcolumns = [
  {
    title: '订单编号',
    width: 180,
    fixed: 'left',
    ellipsis: true,
    dataIndex: 'orderCode',
    // searchKey: 'orderCode',
    scopedSlots: {
      filterDropdown: 'searchInput',
      filterIcon: 'searchIcon',
      customRender: 'orderCode'
    }
  },
  {
    title: '工单数',
    width: 150,
    fixed: 'left',
    ellipsis: true,
    dataIndex: 'produceInfoCount',
    scopedSlots: {}
  },
  {
    title: '物品种类',
    width: 120,
    ellipsis: true,
    dataIndex: 'serialInfoCount',
    scopedSlots: { customRender: 'serialInfoCount' }
  },
  {
    title: '客户',
    width: 120,
    ellipsis: true,
    dataIndex: 'customName',

    scopedSlots: {
      filterDropdown: 'searchInput',
      filterIcon: 'searchIcon',
      customRender: 'customName'
    }
  },
  {
    title: '创建时间',
    width: 100,
    ellipsis: true,
    dataIndex: 'createTime',
    sorter: true,
    scopedSlots: { customRender: 'createTime' }
    // scopedSlots: {
    //   filterDropdown: 'datePicker',
    //   filterIcon: 'dateIcon',
    //   customRender: 'createTime',
    // },
  },
  {
    title: '更新时间',
    width: 100,
    ellipsis: true,
    dataIndex: 'updateTime',
    sorter: true,
    scopedSlots: { customRender: 'updateTime' }
    // scopedSlots: {
    //   filterDropdown: 'datePicker',
    //   filterIcon: 'dateIcon',
    //   customRender: 'updateTime',
    // },
  },
  {
    title: '创建人',
    width: 100,
    ellipsis: true,
    dataIndex: 'createBy',
    scopedSlots: {
      filterDropdown: 'selectPeople',
      filterIcon: 'peopleIcon',
      customRender: 'createBy'
    }
  },
  {
    title: '更新人',
    width: 100,
    ellipsis: true,
    dataIndex: 'updateBy',
    scopedSlots: {
      filterDropdown: 'selectPeople',
      filterIcon: 'peopleIcon',
      customRender: 'updateBy'
    }
  },
  {
    title: '下拉选择',
    width: 100,
    ellipsis: true,
    dataIndex: 'selectChoose',
    scopedSlots: { customRender: 'selectChoose' }
  },
  {
    title: '输入框',
    width: 100,
    ellipsis: true,
    dataIndex: 'inputT',
    scopedSlots: { customRender: 'inputT' }
  },
  {
    title: '时间',
    width: 100,
    ellipsis: true,
    dataIndex: 'time',
    scopedSlots: { customRender: 'time' }
  }
]
export let goodsColumns = [
  {
    title: '序号',
    dataIndex: 'index',
    width: 80,
    scopedSlots: {
      customRender: 'customIndex'
    }
  },
  {
    title: '物品编号',
    key: 'serialNumber',
    dataIndex: 'serialNumber',
    width: 200,
    ellipse: true
  },
  {
    title: '物品名称',
    key: 'serialName',
    dataIndex: 'serialName',
    width: 200,
    ellipse: true
  },
  {
    title: '规格',
    key: 'serialSpecifications',
    dataIndex: 'serialSpecifications',
    width: 200,
    ellipse: true
  },
  {
    title: '物品属性',
    key: 'serialProperties',
    dataIndex: 'serialProperties',
    width: 200,
    ellipse: true
  },
  {
    title: '单位',
    key: 'unitName',
    dataIndex: 'unitName',
    width: 100,
    ellipse: true
  }
]
export let goodsSelectColumns = [
  {
    title: '物品编号',
    dataIndex: 'serialNumber',
    ellipsis: true,
    // fixed: 'left',
    width: 200,
    searchIndex: 'serialNumber',
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'serialNumber'
    }
  },
  {
    title: '物品名称',
    dataIndex: 'serialName',
    ellipsis: true,
    // fixed: 'left',
    width: 180,
    searchIndex: 'serialName',
    options: [],
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'serialName'
    }
  },
  {
    title: '规格',
    dataIndex: 'serialSpecifications',
    ellipsis: true,
    // fixed: 'left',
    width: 180,
    searchIndex: 'serialSpecifications',
    options: [],
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'serialSpecifications'
    }
  },
  {
    title: '物品属性',
    dataIndex: 'serialProperties',
    ellipsis: true,
    // fixed: 'left',
    width: 180,
    searchIndex: 'serialProperties',
    options: [],
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'serialProperties'
    }
  },
  {
    title: '单位',
    dataIndex: 'unitName',
    ellipsis: true,
    // fixed: 'left',
    width: 180,
    searchIndex: 'unitName',
    options: [],
    scopedSlots: {
      // filterDropdown: 'searchDropdown',
      // filterIcon: 'searchIcon',
      // customRender: 'serialUnit',
    }
  },
  {
    title: '工艺路线',
    dataIndex: 'processRouteName',
    ellipsis: true,
    // fixed: 'left',
    width: 180,
    searchIndex: 'processRouteId',
    options: [],
    scopedSlots: {
      filterDropdown: 'selectProcess',
      filterIcon: 'searchIcon',
      customRender: 'processRouteName'
    }
  },
  {
    title: '最小库存',
    dataIndex: 'inventoryMin',
    ellipsis: true,
    // fixed: 'left',
    width: 180,
    searchIndex: 'inventoryMin',
    options: [],
    scopedSlots: {}
  },
  {
    title: '最大库存',
    dataIndex: 'inventoryMax',
    ellipsis: true,
    // fixed: 'left',
    width: 180,
    searchIndex: 'inventoryMax',
    options: [],
    scopedSlots: {}
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    ellipsis: true,
    width: 180,
    searchIndex: 'createTime',
    sorter: true,
    scopedSlots: {
      // filterDropdown: 'selectDropdown',
      // filterIcon: 'dateIcon',
      // customRender: 'createTime',
    }
  },
  {
    title: '更新时间',
    dataIndex: 'updateTime',
    ellipsis: true,
    width: 180,
    searchIndex: 'updateTime',
    sorter: true,
    scopedSlots: {
      // filterDropdown: 'selectDropdown',
      // filterIcon: 'dateIcon',
      // customRender: 'createTime',
    }
  },
  {
    title: '创建人',
    dataIndex: 'createBy',
    ellipsis: true,
    width: 180,
    searchIndex: 'createBy',
    multi: true,

    scopedSlots: {
      filterDropdown: 'selectPeople',
      filterIcon: 'dateIcon'
      // customRender: 'createBy',
    }
  },
  {
    title: '更新人',
    dataIndex: 'updateBy',
    ellipsis: true,
    width: 180,
    searchIndex: 'updateBy',
    multi: true,

    scopedSlots: {
      filterDropdown: 'selectPeople',
      filterIcon: 'dateIcon'
      // customRender: 'updateBy',
    }
  }
]
export let columns = [
  {
    title: '出库单编号',
    dataIndex: 'entryCode',
    ellipsis: true,
    // fixed: 'left',
    width: 200,
    searchIndex: 'entryCode',
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'entryCode'
    }
  },
  {
    title: '出库类型',
    dataIndex: 'outWarehouseTypeName',
    ellipsis: true,
    // fixed: 'left',
    width: 180,
    searchIndex: 'outWarehouseType',
    options: [],
    scopedSlots: {
      filterDropdown: 'selectDropdown',
      filterIcon: 'dateIcon',
      customRender: 'outWarehouseTypeName'
    }
  },
  {
    title: '出库时间',
    dataIndex: 'outWarehouseTime',
    ellipsis: true,
    // fixed: 'left',
    width: 180,
    searchIndex: 'outWarehouseTime',
    options: [],
    scopedSlots: {
      filterDropdown: 'datePicker',
      filterIcon: 'dateIcon',
      customRender: 'outWarehouseTime'
    }
  },
  {
    title: '领出人',
    dataIndex: 'receiverPersionName',
    ellipsis: true,
    // fixed: 'left',
    width: 180,
    searchIndex: 'receiverPersion',
    // options: [],
    scopedSlots: {
      // filterDropdown: 'selectPeople',
      // filterIcon: 'dateIcon',
      customRender: 'receiverPersionName'
    }
  },
  // {
  //   title: '备注',
  //   dataIndex: 'remark',
  //   ellipsis: true,
  //   // fixed: 'left',
  //   width: 180,
  //   searchIndex: 'remark',
  //   scopedSlots: {
  //     filterDropdown: 'searchDropdown',
  //     filterIcon: 'searchIcon',
  //     customRender: 'remark',
  //   },
  // },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    ellipsis: true,
    width: 180,
    searchIndex: 'createTime',
    sorter: true,
    scopedSlots: {
      filterDropdown: 'datePicker',
      filterIcon: 'none',
      customRender: 'createTime'
    }
  },
  {
    title: '更新时间',
    dataIndex: 'updateTime',
    ellipsis: true,
    width: 180,
    searchIndex: 'updateTime',
    sorter: true,
    scopedSlots: {
      filterDropdown: 'datePicker',
      filterIcon: 'none',
      customRender: 'updateTime'
    }
  },
  {
    title: '创建人',
    dataIndex: 'createByName',
    ellipsis: true,
    width: 180,
    searchIndex: 'createBy',
    scopedSlots: {
      filterDropdown: 'createBy',
      filterIcon: 'dateIcon',
      customRender: 'createByName'
    }
  },
  {
    title: '更新人',
    dataIndex: 'updateByName',
    ellipsis: true,
    width: 180,
    searchIndex: 'updateBy',
    scopedSlots: {
      filterDropdown: 'updateBy',
      filterIcon: 'dateIcon',
      customRender: 'updateByName'
    }
  }
]
export let allColumn = [...columns]

export function getTypeList() {
  APILX.warehouseOutboundOrderInfoEntryType().then((res) => {
    let newArrApply = res.result.map((item) => {
      return {
        label: item.itemText,
        key: item.itemValue
      }
    })
    columns[1].options = newArrApply
    allColumn[1].options = newArrApply
  })
}
